<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
    $(function() {
        $("#login").click(function () {
            var email = $("#email").val();
            var password = $("#password").val();
            $.ajax({
                type: "POST",
                url: "http://localhost/api/user/login",
                data: {
                    "email": email,
                    "password": password
                },
                success: function (data) {
                    if(data == ''){
                        alert("邮箱或密码错误");
                    }else{
						//sessionStorage.setItem("token",data.token);
                        window.location.href="/static/welcome.html?"+"email="+encodeURI(data);
						//window.location.href="welcome.html";
						
                    }
                }
            });
        });
    });
</script>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>登陆</title>
</head>
<body>
    <center>
        邮箱&nbsp;<input id="email" type="text"/><br>
        密码&nbsp;<input id="password" type="password"/><br>
        <input id="login" type="button" style="background-color: #339933;width: 180px;color: #FFFFFF" value="登陆"><br>
        <a href="register.html"><font style="color: #339933;">注册新账号</font></a>
    </center>
</body>
</html>